$(function() {
	var token = localStorage.phone;
	$("#btn_ipt").click(function() {
		var content = $("#content").val();

		if(content == "") {
			layer.msg('留言不能为空');
			return false;
		};
		$.ajax({
			url: "https://newapp.icandrive.cn/api/evaluate.php",
			data: {
				token: token,
				evaluate: content,
				order_id: localStorage.pingjiaorderid
			},
			dataType: 'json',
			type: 'post',
			success: function(data) {
				console.log(data);
				if(data.status == 200) {
					layer.msg("评价成功");
					setInterval(function() {
						window.location.href = "../studentorder/oder.html"
					},3000);
				}

				if(data.status == 400) {
					layer.msg("评价失败");
					return false;
				}

				if(data.status == 450) {
					layer.msg("您已经评价");
					setInterval(function() {
						window.location.href = "../studentorder/oder.html"
					},3000);
				}

			},

			error: function() {
				layer.msg('系统繁忙');
			}
		});

	})

	/*监听手机返回按键*/
	return_keybord();
})
